package com.example.hospitalmanagementapp;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.hospitalmanagementapp.adapter.DepartmentAdapter;
import com.example.hospitalmanagementapp.adapter.SystemAdapter;
import com.example.hospitalmanagementapp.bean.DepartmentBean;
import com.example.hospitalmanagementapp.bean.SystemBean;

import java.util.ArrayList;
import java.util.List;


/**
 * @author 席
 * 预约挂号
 */
public class AppointmentActivity extends AppCompatActivity {
    /**
     * 获取到 RecyclerView 复合控件
     */
    RecyclerView recyclerView;

    RecyclerView rightRecyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.appointment);
        initView();
    }

    public void initView() {
        recyclerView=findViewById(R.id.view_genealogical_classify);
        //设置垂直列表
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        //存假数据
        List<SystemBean> dataList=new ArrayList<>();
        dataList.add(new SystemBean(0,"内科系统",false));
        dataList.add(new SystemBean(1,"外科系统",false));
        dataList.add(new SystemBean(2,"妇产系统",false));
        dataList.add(new SystemBean(3,"儿科系统",false));
        dataList.add(new SystemBean(4,"管康复理疗系统",false));
        dataList.add(new SystemBean(5,"五官科系统",false));
        dataList.add(new SystemBean(6,"其他系统",false));
        dataList.add(new SystemBean(7,"发热系统",false));
        SystemAdapter systemAdapter=new SystemAdapter(this);
        systemAdapter.setSystemStr(dataList);
        //将适配器赋值给RecyclerView
        recyclerView.setAdapter(systemAdapter);
        //监听器
        systemAdapter.setSystemListener(new SystemAdapter.ListenerRecyclerView() {
            @Override
            public void onItemClick(int position) {
                boolean select = dataList.get(position).isSelect();
                    select=true;

            }
        });
        //二级列表
        rightRecyclerView=findViewById(R.id.view_branch);
        rightRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        //存假数据
        List<DepartmentBean> departmentList=new ArrayList<>();
        departmentList.add(new DepartmentBean(0,"心理门诊"));
        departmentList.add(new DepartmentBean(1,"消化内科"));
        departmentList.add(new DepartmentBean(2,"中医科"));
        departmentList.add(new DepartmentBean(3,"神经内科"));
        DepartmentAdapter departmentAdapter=new DepartmentAdapter(this);
        departmentAdapter.setDepartmentStr(departmentList);
        rightRecyclerView.setAdapter(departmentAdapter);

        departmentAdapter.setDepartmentListener(new DepartmentAdapter.ListenerRecyclerView() {
            @Override
            public void onItemClick(int position) {

            }
        });
    }
}

